/*
 *  message_queue.cpp
 */

#include <queue>
#include "lock.h"
#include "message_queue.h"
#include "mutex.h"

MessageQueue::MessageQueue() : mutex(), q() {}

MessageQueue::~MessageQueue() {}

void MessageQueue::push(Message* msg) {
    Lock lock(&mutex);
    q.push(msg);
}

Message* MessageQueue::pop() {
    Lock lock(&mutex);
    Message* msg = q.front();
    q.pop();
    return msg;
}

bool MessageQueue::empty() {
    Lock lock(&mutex);
    return q.empty();
}

//{+}

